package org.wit.ecommerce.service;

import java.util.List;
import java.util.Map;

import org.wit.ecommerce.domain.Transaction;
import org.wit.ecommerce.domain.TransactionLog;
import org.wit.ecommerce.dto.Navigator;
/**
 * 
 * @author Justin
 *
 */
public interface ITransactionService {
	/**
	 * add a new transaction
	 * @param transaction
	 * @return
	 */
	void createTransaction(Transaction transaction);
	
	/**
	 * get a transaction by id
	 * @param id
	 * @return
	 */
	Transaction getTransactionById(Long id);
	
	/**
	 * get transactions by page and criteria; use this function when you 
	 * want to search transactions.
	 * @param page
	 * @param keywords the criteria of the search
	 * @return
	 */
	Navigator<Transaction> getTransactionsByKeywords(int page, Map<String, ?> keywords);
	
	/**
	 * get a transaction by pin number
	 * @param pin
	 * @return
	 */
	Transaction getTransactionByPin(String pin);
	
	/**
	 * update a transaction
	 * @param transaction
	 * @return
	 */
	void updateTransaction(Transaction transaction);
	
	/**
	 * change a transaction's status
	 * @param status
	 * @return
	 */
	void changeTransactionStatus(Long id, int status);
	
	/**
	 * batch delete of transactions
	 * @param ids
	 */
	void deleteTransactionsByIds(Long[] ids);
	
	/**
	 * get transaction logs by transaction's id
	 * @param id
	 * @return
	 */
	List<TransactionLog> getTransactionLogs(Long id);
}
